

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, RefreshType) {
    RefreshTypeHeader   = 0,
    RefreshTypeFooter   = 1,
    RefreshTypeBoth     = 2
};

typedef NS_ENUM(NSInteger, RefreshHud) {
    RefreshHudNone      = 0,    // 无加载指示
    RefreshHudDefault   = 1,    // 默认mj
    RefreshHudCustom    = 2     // 自定义菊花
};

@interface UIScrollView (Refresh)

/// 接口
@property (nonatomic, copy) NSString *urlString;
/// 参数
@property (nonatomic, strong) NSDictionary *parameters;
/// 加载分页类型 YES:id NO:page
@property (nonatomic) BOOL pagingWithID;
/// 分页id字符串(仅在pagingWithID==YES下有效)
@property (nonatomic, copy) NSString *idString;
/// 是否没有更多数据了,这个字段不能赋值
@property (nonatomic) BOOL noMoreData;

@property (nonatomic, copy) void(^willRefreshingHeader)(void);
@property (nonatomic, copy) void(^willRefreshingFooter)(void);
@property (nonatomic, copy) void(^didRefreshingHeaderSuccess)(id responseObject);
@property (nonatomic, copy) void(^didRefreshingHeaderEmpty)(id responseObject);
@property (nonatomic, copy) void(^didRefreshingHeaderFailure)(NSError *error);
@property (nonatomic, copy) void(^didRefreshingFooterSuccess)(id responseObject);
@property (nonatomic, copy) void(^didRefreshingFooterEmpty)(id responseObject);
@property (nonatomic, copy) void(^didRefreshingFooterFailure)(NSError *error);

@property (nonatomic) BOOL headerRefreshEnabled;
@property (nonatomic) BOOL footerRefreshEnabled;

- (void)addHeaderRefreshingBlock:(void(^)(void))headerBlock;
- (void)addFooterRefreshingBlock:(void(^)(void))footerBlock;
- (void)endRefreshing:(RefreshType)type;
- (void)endRefreshingWithNoMoreData;
- (void)resetNoMoreData;

- (void)beginRefreshing:(RefreshHud)hud;
- (void)beginRefreshingFooter:(RefreshHud)hud;

@end
